# -*- coding: utf-8 -*-
# Author: xiantingDeng
# File: 02_正则表达式实例.py
# Time: 16:58


text = '''
<!DOCTYPE html>
<html>
<head>
    <title>Python 正则表达式实例</title>
</head>
<body>
    <h2>常用网站链接</h2>
    <ul>
        <li><a href="https://www.python.org">Python官方网站</a></li>
        <li><a href="https://www.djangoproject.com">Django官方网站</a></li>
        <li><a href="https://www.baidu.com">百度搜索引擎</a></li>
        <li><a href="https://blog.csdn.net">CSDN官方网站</a></li>
        <li><a href="https://edu.csdn.net/">CSDN学院</a></li>
    </ul>
</body>
</html>
'''

import re

title = re.search("<title>(.*?)</title>",text)
if title:
    print(title)
    print(title.group())

alist = re.findall('<a href="(.*?)">(.*?)</a>',text)

for ov in alist:
    print(ov[1]+":"+ov[0])